package com.treasure.mall.biz.entity.pay;

import com.treasure.mall.biz.entity.Base2PO;
import com.treasure.mall.biz.entity.user.UserPO;
import com.treasure.mall.zbq.common.constant.Constant;
import com.treasure.mall.zbq.common.ienum.order.OrderEnums;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 退款单
 *
 * @author allan
 * @version 1.0.0
 * @date 2020/6/14
 */
@Entity
@Table(name = "zb_refund_bill")
@Setter
@Getter
public class RefundBillPO extends Base2PO {
    @Id
    @Column(name = "id", length = 30)
    private String id;
    /**
     * 退款用户
     */
    @ManyToOne
    @JoinColumn(name = "rel_user_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    private UserPO userPO;
    /**
     * 对应的售后单
     */
    @Column(name = "after_sale_bill")
    private String afterSaleId;
    /**
     * 所属子订单
     */
    @Column(name = "order_id")
    private String orderId;
    /**
     * 第三方退款单号
     */
    @Column(name = "third_refund_no")
    private String thirdRefundNo;
    /**
     * 退款金额
     */
    @Column(name = "amount", scale = 2, precision = 10)
    private BigDecimal amount;
    @Column(name = "pay_type")
    private OrderEnums.PayType payType;
    @Column(name = "refund_type")
    private OrderEnums.RefundType refundType;
    @Column(name = "deal_type")
    private OrderEnums.DealType dealType;
    /**
     * 退款时间
     */
    @Column(name = "refund_time", columnDefinition = Constant.DATE_COLUMN_DEFINITION)
    private LocalDateTime refundTime;
    /**
     * 到账时间
     */
    @Column(name = "arrive_time", columnDefinition = Constant.DATE_COLUMN_DEFINITION)
    private LocalDateTime ArriveTime;
    /**
     * 是否成功
     */
    @Column(name = "is_success")
    private boolean success;
    /**
     * 入账信息
     */
    @Column(name = "credit_info")
    private String creditInfo;
    @Column(name = "result_desc")
    private String resultDesc;
}
